package com.siyuanren.gcocp.enums.wx;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * 模版消息任务通知Task类型
 *
 * @author guwr
 */
@Getter
public enum KefuMsgTypeEnum {
    SIGN_UP_SUCCESS_NOTICE("报名成功通知", 1,"你已成功报名课程《%s》，请耐心等待%s报到！"),
    RECEIVE_NOTICE("领取通知书通知", 2,"你的【毕业福利】已发送，可以发送该优惠券给好友优惠报名"),
    FRIEND_RECEIVE_COUPON_NOTICE("好友领取优惠券通知", 3,"你的好友【%s】已成功领取你赠送的课程优惠券"),
    FRIEND_RECEIVE_COUPON_USE_NOTICE("好友优惠券使用通知", 4,"你的好友【%s】已经使用你的优惠卷，成功报名课程《%s》"),
    ;
    private String desc;
    private int value;
    private String content;


    KefuMsgTypeEnum(String desc, int value, String content) {
        this.desc = desc;
        this.value = value;
        this.content = content;
    }

    public static KefuMsgTypeEnum getModel(int value) {
        for (KefuMsgTypeEnum he : KefuMsgTypeEnum.values()) {
            if (Objects.equals(value, he.getValue())) {
                return he;
            }
        }
        return null;
    }

    public static String getEnumDesc(Integer value) {
        if (value == null) {
            return StringUtils.EMPTY;
        }
        KefuMsgTypeEnum model = getModel(value);
        if (model == null) {
            return StringUtils.EMPTY;
        }
        return model.getDesc();
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
    public void setValue(int value) {
        this.value = value;
    }
}